<script setup lang="ts">
import { ref } from 'vue'
import {FormItemProps} from '../../interface/form.ts'
const form = ref(null)
const props = defineProps({
  request: Function,
  dataSource: Array<FormItemProps>
})
interface form {
  request?: Function,
  dataSource?: Array<FormItemProps>
}



</script>

<template>
<el-form ref="form">
  <el-form-item v-for="item in props.dataSource" :label="item.label" :prop="item.prop" :rules="item.rules">
    <el-input v-if="item.type === 'input'" v-model="item.value" />
    <el-select v-else-if="item.type === 'select'" v-model="item.value">
      <el-option v-for="option in item.options" :label="option.label" :value="option.value" />
    </el-select>
  </el-form-item>
  <el-button type="primary" @click="props.request">提交</el-button>
</el-form>
</template>

<style scoped>

</style>
